<#assign title="忘记密码—邮箱找回" />
<#include 'common/header.html' />
<script type="text/javascript">var forward = '${forward!''}'</script>
<link rel="stylesheet" href="${ctx}${themes_path}/css/other.css" type="text/css" />

<div id="navigator" style="background-color: rgb(255, 103, 0);">
	<div id="nav-left">
		<div class="item light"></div>
	</div>
	<div id="nav-middle" style="color: rgb(255, 255, 255);">找回密码</div>
	<div id="nav-right">
	</div>
</div>



<div id="findpwd_wrapper">
	<div class="findpwd-box">
		<div class="find-title">
			<ul>
				<li class="find-title-email selected">邮箱找回</li>
				<li class="find-title-phone">手机找回</li>
			</ul>
		</div>
 		<div class="find-by-email same-find">
			<form  method="post"  class="validate" id="findPsswordForm">
				<div class="find-way">
					<span>选择找回方式</span>
					<label>
						<input type="radio" name="choose" value="0" checked="checked"/>
						<p>邮箱</p>
						<i class="selected"></i>
					</label>
					<label>
						<input type="radio" name="choose" value="1"/>
						<p>用户名</p>
						<i></i>
					</label>
				</div>
				<input type="text"  maxlength="200" id="reg_email"   name="email"  placeholder="请输入您的注册邮箱或用户名" value="" class="find-word" >
				<div class="find-password">
					<a id="apply" class="btn btn-success" >确定</a>
					<a class="btn btn-default" href="javascript:history.go(-1)">返回</a>
				</div>
			</form>
		</div> 
		<div class="find-by-phone same-find" style="display:none;">
		</div>
	</div>
</div>
<script type="text/javascript">
	$(function(){
		$(".find-by-phone").load("findpasswordByMobile.html");
		
		//通过邮箱有户名找回密码
		$("#apply").click(function(){
			//需要验证邮箱格式 或用户名格式
			/* if(!$("#findPsswordForm").checkall())
				return false; */
			var options = {
					url : "${ctx}/api/shop/findPasswordbyEmail/find.do",
					type : "POST",
					dataType : "json",
					success : function(result) {
						if(result.result==0){
							alert(result.message);
						}else{
							alert(result.message);
						}
				 	},
				 	error : function(e) {
				 		alert('出现错误，请重试');
					}
				};
			
			$("#findPsswordForm").ajaxSubmit(options);
		});
		
		//切换选择
		$(".find-by-email label i").click(function(){
			$(".find-by-email label i").removeClass("selected");
			$(this).addClass("selected");
		})
		
		//找回方式切换
		$(".find-title-email").click(function(){
			$(".find-by-email").show();
			$(".find-by-phone").hide();
			$(".find-title ul li").removeClass("selected");
			$(this).addClass("selected");
		})
		
		$(".find-title-phone").click(function(){
			$(".find-by-email").hide();
			$(".find-by-phone").load("findpasswordByMobile.html");
			$(".find-by-phone").show();
			$(".find-title ul li").removeClass("selected");
			$(this).addClass("selected");
		})
		
	})
</script>
<#include 'common/footer.html' />